% GAUTIER LE BIHAN - 2020
% Replication files for "Shocks vs Menu Costs: Patterns of Price Rigidity in an Estimated Multi-Sector Menu-Cost Model?" Review of Economics and Statistics
%
% Figure P + Table 4


clear;
tic
addpath('..\..\Utilities')  

load actual_moments_k
load res_estim_prod2nb
param=res_estim_prod2nb

param0=   [param(1) param(3)  param(5);
           param(2) param(4)  param(6) ];% 

p0=abs(tanh(param0(:,1)));
mu_c=abs(param0(:,2));
sig_a=exp(param0(:,3));
rho_a=ones(2,1)*0.69;

param_he=[p0(1) mu_c(1) sig_a(1) rho_a(1)];
param_e=[p0(2) mu_c(2) sig_a(2) rho_a(2)];

param_med2=[param_he' param_e'];
weight_sect2=[0.52; 0.05];

param_ms(1).param_ms=param_med2;
weight_ms(1).weight_ms=weight_sect2;


s=1;
%stat_mean2_apr2018=ones(s,6);
for jj=1:s;
    
    param_med=param_ms(jj).param_ms;
    weight_sect=weight_ms(jj).weight_ms;
    p0=param_med(1,:);
    mu_c=param_med(2,:);
    sig_eps_a=param_med(3,:);
    rho_a=param_med(4,:);
    w=weight_sect'
    sm_m=0;
   [av_moments, moments, VC, IRF]=geNCalvoPlus_2Agg(sm_m, p0, mu_c, sig_eps_a, rho_a, w);
 
 moments
  stat_mean2_19d(jj,:)=[av_moments sqrt(VC)]
  save stat_mean2_19d stat_mean2_19d;
   IRF_mean2_19d(jj,:)=[ IRF]
  save IRF_mean2_19d IRF_mean2_19d;
  stat_sect2_19d(jj,:)=[moments]
  save stat_sect2_19d stat_sect2_19d;
  
end
